﻿
namespace Indeco.G24.Windows.Forms
{
	/// <summary>
	/// abstract TinTuc typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class TinTucDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<TinTucDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.TinTuc _currentTinTuc = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxTinTucDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxTinTucErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxTinTucBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the IDTinTuc property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDTinTucDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDTinTucDanhMuc property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDTinTucDanhMucDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the TieuDe property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxTieuDeDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the MoTa property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMoTaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the NoiDung property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNoiDungDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the HinhMinhHoa property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxHinhMinhHoaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the MoTaHinh property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMoTaHinhDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the SolanXem property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSolanXemDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the NguonTin property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNguonTinDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the NhaCungCap property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNhaCungCapDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the TrangThai property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxTrangThaiDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThoiDiemChinhSua property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThoiDiemChinhSuaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThoiDiemCapNhat property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThoiDiemCapNhatDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.TinTucDanhMuc> _IDTinTucDanhMucList;
		
		/// <summary> 
		/// The list of selectable TinTucDanhMuc
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.TinTucDanhMuc> IDTinTucDanhMucList
		{
			get {return this._IDTinTucDanhMucList;}
			set 
			{
				this._IDTinTucDanhMucList = value;
				this.uxIDTinTucDanhMucDataGridViewColumn.DataSource = null;
				this.uxIDTinTucDanhMucDataGridViewColumn.DataSource = this._IDTinTucDanhMucList;
			}
		}
		
		private bool _allowNewItemInIDTinTucDanhMucList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of TinTucDanhMuc
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDTinTucDanhMucList
		{
			get { return _allowNewItemInIDTinTucDanhMucList;}
			set
			{
				this._allowNewItemInIDTinTucDanhMucList = value;
				this.uxIDTinTucDanhMucDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.TinTuc> _TinTucList;
				
		/// <summary> 
		/// The list of TinTuc to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.TinTuc> TinTucList
		{
			get {return this._TinTucList;}
			set
			{
				this._TinTucList = value;
				this.uxTinTucBindingSource.DataSource = null;
				this.uxTinTucBindingSource.DataSource = value;
				this.uxTinTucDataGridView.DataSource = null;
				this.uxTinTucDataGridView.DataSource = this.uxTinTucBindingSource;				
				//this.uxTinTucBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxTinTucBindingSource_ListChanged);
				this.uxTinTucBindingSource.CurrentItemChanged += new System.EventHandler(OnTinTucBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnTinTucBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentTinTuc = uxTinTucBindingSource.Current as Entities.TinTuc;
			
			if (_currentTinTuc != null)
			{
				_currentTinTuc.Validate();
			}
			//_TinTuc.Validate();
			OnCurrentEntityChanged();
		}

		//void uxTinTucBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.TinTuc"/> instance.
		/// </summary>
		public Entities.TinTuc SelectedTinTuc
		{
			get {return this._currentTinTuc;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxTinTucDataGridView.VirtualMode;}
			set
			{
				this.uxTinTucDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxTinTucDataGridView.AllowUserToAddRows;}
			set {this.uxTinTucDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxTinTucDataGridView.AllowUserToDeleteRows;}
			set {this.uxTinTucDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxTinTucDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxTinTucDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="TinTucDataGridViewBase"/> class.
		/// </summary>
		public TinTucDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxTinTucDataGridView = new System.Windows.Forms.DataGridView();
			this.uxTinTucBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxTinTucErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDTinTucDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDTinTucDanhMucDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxTieuDeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxMoTaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNoiDungDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxHinhMinhHoaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxMoTaHinhDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxSolanXemDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNguonTinDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNhaCungCapDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTrangThaiDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxThoiDiemChinhSuaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxThoiDiemCapNhatDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDTinTucDanhMucBindingSource = new TinTucDanhMucBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDTinTucDanhMucBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxTinTucDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxTinTucBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxTinTucErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxTinTucErrorProvider
			// 
			this.uxTinTucErrorProvider.ContainerControl = this;
			this.uxTinTucErrorProvider.DataSource = this.uxTinTucBindingSource;						
			// 
			// uxTinTucDataGridView
			// 
			this.uxTinTucDataGridView.AutoGenerateColumns = false;
			this.uxTinTucDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxTinTucDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDTinTucDataGridViewColumn,
		this.uxIDTinTucDanhMucDataGridViewColumn,
		this.uxTieuDeDataGridViewColumn,
		this.uxMoTaDataGridViewColumn,
		this.uxNoiDungDataGridViewColumn,
		this.uxHinhMinhHoaDataGridViewColumn,
		this.uxMoTaHinhDataGridViewColumn,
		this.uxSolanXemDataGridViewColumn,
		this.uxNguonTinDataGridViewColumn,
		this.uxNhaCungCapDataGridViewColumn,
		this.uxTrangThaiDataGridViewColumn,
		this.uxThoiDiemChinhSuaDataGridViewColumn,
		this.uxThoiDiemCapNhatDataGridViewColumn			});
			this.uxTinTucDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxTinTucDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxTinTucDataGridView.Name = "uxTinTucDataGridView";
			this.uxTinTucDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxTinTucDataGridView.TabIndex = 0;	
			this.uxTinTucDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxTinTucDataGridView.EnableHeadersVisualStyles = false;
			this.uxTinTucDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnTinTucDataGridViewDataError);
			this.uxTinTucDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnTinTucDataGridViewCellValueNeeded);
			this.uxTinTucDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnTinTucDataGridViewCellValuePushed);
			
			//
			// uxIDTinTucDataGridViewColumn
			//
			this.uxIDTinTucDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDTinTucDataGridViewColumn.DataPropertyName = "IDTinTuc";
			this.uxIDTinTucDataGridViewColumn.HeaderText = "IDTinTuc";
			this.uxIDTinTucDataGridViewColumn.Name = "uxIDTinTucDataGridViewColumn";
			this.uxIDTinTucDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDTinTucDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDTinTucDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDTinTucDanhMucDataGridViewColumn
			//
			this.uxIDTinTucDanhMucDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDTinTucDanhMucDataGridViewColumn.DataPropertyName = "IDTinTucDanhMuc";
			this.uxIDTinTucDanhMucDataGridViewColumn.HeaderText = "IDTinTucDanhMuc";
			this.uxIDTinTucDanhMucDataGridViewColumn.Name = "uxIDTinTucDanhMucDataGridViewColumn";
			this.uxIDTinTucDanhMucDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDTinTucDanhMucDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDTinTucDanhMucDataGridViewColumn.ReadOnly = false;		
			//
			// uxTieuDeDataGridViewColumn
			//
			this.uxTieuDeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTieuDeDataGridViewColumn.DataPropertyName = "TieuDe";
			this.uxTieuDeDataGridViewColumn.HeaderText = "TieuDe";
			this.uxTieuDeDataGridViewColumn.Name = "uxTieuDeDataGridViewColumn";
			this.uxTieuDeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTieuDeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTieuDeDataGridViewColumn.ReadOnly = false;		
			//
			// uxMoTaDataGridViewColumn
			//
			this.uxMoTaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMoTaDataGridViewColumn.DataPropertyName = "MoTa";
			this.uxMoTaDataGridViewColumn.HeaderText = "MoTa";
			this.uxMoTaDataGridViewColumn.Name = "uxMoTaDataGridViewColumn";
			this.uxMoTaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMoTaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMoTaDataGridViewColumn.ReadOnly = false;		
			//
			// uxNoiDungDataGridViewColumn
			//
			this.uxNoiDungDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNoiDungDataGridViewColumn.DataPropertyName = "NoiDung";
			this.uxNoiDungDataGridViewColumn.HeaderText = "NoiDung";
			this.uxNoiDungDataGridViewColumn.Name = "uxNoiDungDataGridViewColumn";
			this.uxNoiDungDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNoiDungDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNoiDungDataGridViewColumn.ReadOnly = false;		
			//
			// uxHinhMinhHoaDataGridViewColumn
			//
			this.uxHinhMinhHoaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxHinhMinhHoaDataGridViewColumn.DataPropertyName = "HinhMinhHoa";
			this.uxHinhMinhHoaDataGridViewColumn.HeaderText = "HinhMinhHoa";
			this.uxHinhMinhHoaDataGridViewColumn.Name = "uxHinhMinhHoaDataGridViewColumn";
			this.uxHinhMinhHoaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxHinhMinhHoaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxHinhMinhHoaDataGridViewColumn.ReadOnly = false;		
			//
			// uxMoTaHinhDataGridViewColumn
			//
			this.uxMoTaHinhDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMoTaHinhDataGridViewColumn.DataPropertyName = "MoTaHinh";
			this.uxMoTaHinhDataGridViewColumn.HeaderText = "MoTaHinh";
			this.uxMoTaHinhDataGridViewColumn.Name = "uxMoTaHinhDataGridViewColumn";
			this.uxMoTaHinhDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMoTaHinhDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMoTaHinhDataGridViewColumn.ReadOnly = false;		
			//
			// uxSolanXemDataGridViewColumn
			//
			this.uxSolanXemDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSolanXemDataGridViewColumn.DataPropertyName = "SolanXem";
			this.uxSolanXemDataGridViewColumn.HeaderText = "SolanXem";
			this.uxSolanXemDataGridViewColumn.Name = "uxSolanXemDataGridViewColumn";
			this.uxSolanXemDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSolanXemDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSolanXemDataGridViewColumn.ReadOnly = false;		
			//
			// uxNguonTinDataGridViewColumn
			//
			this.uxNguonTinDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNguonTinDataGridViewColumn.DataPropertyName = "NguonTin";
			this.uxNguonTinDataGridViewColumn.HeaderText = "NguonTin";
			this.uxNguonTinDataGridViewColumn.Name = "uxNguonTinDataGridViewColumn";
			this.uxNguonTinDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNguonTinDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNguonTinDataGridViewColumn.ReadOnly = false;		
			//
			// uxNhaCungCapDataGridViewColumn
			//
			this.uxNhaCungCapDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNhaCungCapDataGridViewColumn.DataPropertyName = "NhaCungCap";
			this.uxNhaCungCapDataGridViewColumn.HeaderText = "NhaCungCap";
			this.uxNhaCungCapDataGridViewColumn.Name = "uxNhaCungCapDataGridViewColumn";
			this.uxNhaCungCapDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNhaCungCapDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNhaCungCapDataGridViewColumn.ReadOnly = false;		
			//
			// uxTrangThaiDataGridViewColumn
			//
			this.uxTrangThaiDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTrangThaiDataGridViewColumn.DataPropertyName = "TrangThai";
			this.uxTrangThaiDataGridViewColumn.HeaderText = "TrangThai";
			this.uxTrangThaiDataGridViewColumn.Name = "uxTrangThaiDataGridViewColumn";
			this.uxTrangThaiDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTrangThaiDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTrangThaiDataGridViewColumn.ReadOnly = false;		
			//
			// uxThoiDiemChinhSuaDataGridViewColumn
			//
			this.uxThoiDiemChinhSuaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThoiDiemChinhSuaDataGridViewColumn.DataPropertyName = "ThoiDiemChinhSua";
			this.uxThoiDiemChinhSuaDataGridViewColumn.HeaderText = "ThoiDiemChinhSua";
			this.uxThoiDiemChinhSuaDataGridViewColumn.Name = "uxThoiDiemChinhSuaDataGridViewColumn";
			this.uxThoiDiemChinhSuaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThoiDiemChinhSuaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThoiDiemChinhSuaDataGridViewColumn.ReadOnly = false;		
			//
			// uxThoiDiemCapNhatDataGridViewColumn
			//
			this.uxThoiDiemCapNhatDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThoiDiemCapNhatDataGridViewColumn.DataPropertyName = "ThoiDiemCapNhat";
			this.uxThoiDiemCapNhatDataGridViewColumn.HeaderText = "ThoiDiemCapNhat";
			this.uxThoiDiemCapNhatDataGridViewColumn.Name = "uxThoiDiemCapNhatDataGridViewColumn";
			this.uxThoiDiemCapNhatDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThoiDiemCapNhatDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThoiDiemCapNhatDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDTinTucDanhMucDataGridViewColumn
			//				
			this.uxIDTinTucDanhMucDataGridViewColumn.DisplayMember = "IDTinTucDanhMucCha";	
			this.uxIDTinTucDanhMucDataGridViewColumn.ValueMember = "IDTinTucDanhMuc";	
			this.uxIDTinTucDanhMucDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDTinTucDanhMucDataGridViewColumn.DataSource = uxIDTinTucDanhMucBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxTinTucDataGridView);
			this.Name = "TinTucDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDTinTucDanhMucBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxTinTucErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxTinTucDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxTinTucBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				TinTucDataGridViewEventArgs args = new TinTucDataGridViewEventArgs();
				args.TinTuc = _currentTinTuc;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class TinTucDataGridViewEventArgs : System.EventArgs
		{
			private Entities.TinTuc	_TinTuc;
	
			/// <summary>
			/// the  Entities.TinTuc instance.
			/// </summary>
			public Entities.TinTuc TinTuc
			{
				get { return _TinTuc; }
				set { _TinTuc = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxTinTucDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnTinTucDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxTinTucDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnTinTucDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxTinTucDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDTinTucDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].IDTinTuc;
						break;
					case "uxIDTinTucDanhMucDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].IDTinTucDanhMuc;
						break;
					case "uxTieuDeDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].TieuDe;
						break;
					case "uxMoTaDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].MoTa;
						break;
					case "uxNoiDungDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].NoiDung;
						break;
					case "uxHinhMinhHoaDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].HinhMinhHoa;
						break;
					case "uxMoTaHinhDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].MoTaHinh;
						break;
					case "uxSolanXemDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].SolanXem;
						break;
					case "uxNguonTinDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].NguonTin;
						break;
					case "uxNhaCungCapDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].NhaCungCap;
						break;
					case "uxTrangThaiDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].TrangThai;
						break;
					case "uxThoiDiemChinhSuaDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].ThoiDiemChinhSua;
						break;
					case "uxThoiDiemCapNhatDataGridViewColumn":
						e.Value = TinTucList[e.RowIndex].ThoiDiemCapNhat;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxTinTucDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnTinTucDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxTinTucDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDTinTucDataGridViewColumn":
						TinTucList[e.RowIndex].IDTinTuc = (System.Guid)e.Value;
						break;
					case "uxIDTinTucDanhMucDataGridViewColumn":
						TinTucList[e.RowIndex].IDTinTucDanhMuc = (System.Guid)e.Value;
						break;
					case "uxTieuDeDataGridViewColumn":
						TinTucList[e.RowIndex].TieuDe = (System.String)e.Value;
						break;
					case "uxMoTaDataGridViewColumn":
						TinTucList[e.RowIndex].MoTa = (System.String)e.Value;
						break;
					case "uxNoiDungDataGridViewColumn":
						TinTucList[e.RowIndex].NoiDung = (System.String)e.Value;
						break;
					case "uxHinhMinhHoaDataGridViewColumn":
						TinTucList[e.RowIndex].HinhMinhHoa = (System.String)e.Value;
						break;
					case "uxMoTaHinhDataGridViewColumn":
						TinTucList[e.RowIndex].MoTaHinh = (System.String)e.Value;
						break;
					case "uxSolanXemDataGridViewColumn":
						TinTucList[e.RowIndex].SolanXem = (System.Int64)e.Value;
						break;
					case "uxNguonTinDataGridViewColumn":
						TinTucList[e.RowIndex].NguonTin = (System.String)e.Value;
						break;
					case "uxNhaCungCapDataGridViewColumn":
						TinTucList[e.RowIndex].NhaCungCap = (System.String)e.Value;
						break;
					case "uxTrangThaiDataGridViewColumn":
						TinTucList[e.RowIndex].TrangThai = (System.Boolean)e.Value;
						break;
					case "uxThoiDiemChinhSuaDataGridViewColumn":
						TinTucList[e.RowIndex].ThoiDiemChinhSua = (System.DateTime)e.Value;
						break;
					case "uxThoiDiemCapNhatDataGridViewColumn":
						TinTucList[e.RowIndex].ThoiDiemCapNhat = (System.DateTime)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
